Grant
Kennedy
Nixon
Bush
Grant
Kennedy
Nixon
Bush
The research presented in this document does not represent the official views of the Army. The opinions and findings expressed herein are solely those of the authors or contributors and do not reflect Army policy or endorsement.
Why are you at Baylor and why are you trying to answer this question…?
Dr David Kahle
Author of {ggmap}, {mpoly}, {algstat}, {latter}, {m2r}, {bertini}
Dr (COL R) Rodney Sturdivant
Applied Logistic Regression
Associate Professor and Director of the Statistical Consulting Center
Are leaders with military
experience more likely to
lead their countries in a
militarized dispute?
Statistics
R
Real World Question
Statistics
\(\log\left(\frac{p}{1-p}\right) = \beta_0 + \beta_1X_1 + \beta_2X_2 + \ldots + \beta_kX_k\)
Statistics
R
Real World Question
R
Statistics
R
Real World Question
Real World Question
Real World Question
Statistics
R
Real World Question
Univariable Analysis
Initial Multivariable Model
Compare Models
Preliminary Main Effects Model
Main Effects Model
Preliminary Final Model
Adequacy and Model Fit
univariable <- function(factor) {
formula <- str_c("cwinit", "~", factor)
glm(formula, data = data, family = binomial(link = "logit")) |>
broom::tidy() |>
select(term, estimate, p.value) |>
filter(term != "(Intercept)")
}| term | estimate | p.value | odds |
|---|---|---|---|
| year | −0.01 | <0.01 | 0.99 |
| warwin | 0.89 | <0.01 | 2.44 |
| rebelloss | 1.21 | <0.01 | 3.34 |
| combat | 0.48 | <0.01 | 1.62 |
| rebel | 0.33 | <0.01 | 1.39 |
| rebelwin | 0.46 | <0.01 | 1.58 |
| careerpolitician | −0.32 | <0.01 | 0.73 |
| religion | 0.74 | <0.01 | 2.10 |
| age | 0.01 | <0.01 | 1.01 |
| warloss | 0.40 | <0.01 | 1.49 |
| marriedinpower | −0.38 | <0.01 | 0.69 |
| business | −0.44 | <0.01 | 0.64 |
| medicine | −0.87 | <0.01 | 0.42 |
| militarycareer | 0.24 | <0.01 | 1.27 |
| milnoncombat | 0.30 | <0.01 | 1.35 |
| polity21 | −0.01 | <0.01 | 0.99 |
| numGPs | 0.08 | <0.01 | 1.09 |
| divorced | −0.24 | <0.01 | 0.79 |
| teacher | 0.19 | <0.01 | 1.21 |
| parstability | 0.25 | <0.01 | 1.28 |
| totalspouses | −0.06 | <0.01 | 0.94 |
| married | −0.31 | <0.01 | 0.74 |
| activist | 0.14 | <0.01 | 1.15 |
| illegit | −0.36 | <0.01 | 0.70 |
| childtotal | −0.01 | 0.03 | 0.99 |
| gender | 0.34 | 0.07 | 1.41 |
| aristocratlandowner | −0.14 | 0.07 | 0.87 |
| law | −0.07 | 0.19 | 0.93 |
| police | −0.26 | 0.26 | 0.77 |
| orphanbinary | −0.14 | 0.28 | 0.87 |
| officetenure1000 | −0.01 | 0.41 | 0.99 |
| bluecollar | −0.04 | 0.50 | 0.96 |
| royalty | −0.04 | 0.52 | 0.96 |
| scienceeng | 0.04 | 0.70 | 1.04 |
| random | <0.01 | 0.85 | 1.01 |
| journalism | <0.01 | 0.99 | 1.00 |
| creative | 0.00 | 1.00 | 1.00 |
| Interaction | combat | milnoncombat | militarycareer |
|---|---|---|---|
| 000 | – | – | – |
| 101 | ☑️ | – | ☑️ |
| 100 | ☑️ | – | – |
| 010 | – | ☑️ | – |
| 011 | – | ☑️ | ☑️ |
| term | log_odds | odds_ratio | p.value |
|---|---|---|---|
| (Intercept) | −3.71 | 0.02 | <0.01 |
| log_yearssincemidinit | −1.16 | 0.31 | <0.01 |
| illegit1 | −0.51 | 0.60 | 0.02 |
| medicine1 | −0.47 | 0.63 | 0.06 |
| royalty1 | −0.39 | 0.67 | <0.01 |
| age | 0.01 | 1.01 | 0.02 |
| officetenure1000 | 0.03 | 1.03 | 0.04 |
| milnoncombat_combat_militarycareer101 | 0.26 | 1.29 | 0.07 |
| parstability1 | 0.29 | 1.33 | 0.11 |
| milnoncombat_combat_militarycareer011 | 0.33 | 1.38 | <0.01 |
| yearssincemidinit | 0.35 | 1.42 | <0.01 |
| milnoncombat_combat_militarycareer010 | 0.43 | 1.53 | 0.01 |
| creative1 | 0.55 | 1.73 | 0.04 |
| rebelloss1 | 0.70 | 2.00 | <0.01 |
| milnoncombat_combat_militarycareer100 | 0.87 | 2.40 | <0.01 |
| term | log_odds | odds_ratio | p.value |
|---|---|---|---|
| (Intercept) | −3.71 | 0.02 | <0.01 |
| log_yearssincemidinit | −1.16 | 0.31 | <0.01 |
| illegit1 | −0.51 | 0.60 | 0.02 |
| medicine1 | −0.47 | 0.63 | 0.06 |
| royalty1 | −0.39 | 0.67 | <0.01 |
| age | 0.01 | 1.01 | 0.02 |
| officetenure1000 | 0.03 | 1.03 | 0.04 |
| milnoncombat_combat_militarycareer101 | 0.26 | 1.29 | 0.07 |
| parstability1 | 0.29 | 1.33 | 0.11 |
| milnoncombat_combat_militarycareer011 | 0.33 | 1.38 | <0.01 |
| yearssincemidinit | 0.35 | 1.42 | <0.01 |
| milnoncombat_combat_militarycareer010 | 0.43 | 1.53 | 0.01 |
| creative1 | 0.55 | 1.73 | 0.04 |
| rebelloss1 | 0.70 | 2.00 | <0.01 |
| milnoncombat_combat_militarycareer100 | 0.87 | 2.40 | <0.01 |
\[\begin{align*} \Delta \hat{\beta} & : \text{The change in } \hat{\beta} \text{ when an observation is removed.} \\ \Delta \chi^2 & : \text{The change in the Pearson chi-square statistic with observation removed.} \\ \Delta D_i & : \text{The change in the deviance statistic when an observation is removed.} \\ \mathcal{h} & : \text{Leverage.} \\ \mathcal{sdr} & : \text{The standardized deviance residual.} \end{align*}\]